package com.fg.pro.ai.AiController;

import com.alibaba.cloud.ai.dashscope.chat.DashScopeChatModel;
import com.fg.pro.model.reponse.ResponseResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.PromptChatMemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.chat.memory.MessageWindowChatMemory;
import org.springframework.ai.chat.memory.repository.jdbc.JdbcChatMemoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "toolChat",description = "toolChat")
@RestController
@RequestMapping("toolChat")
public class ToolChatController {


    @Qualifier(value = "toolClient")
    @Autowired
    ChatClient toolClient;



    @Operation(summary = "阻塞模式回答",description = "")
    @GetMapping("/chartByBlock")
    public ResponseResult chartByBlock(@RequestParam(required = true,defaultValue = "开个玩笑")String question){
        String content = toolClient.prompt().user(question).call().content();
        return ResponseResult.okResult(content);
    } 




}
